import React, { Component, createRef } from "react";

export default class UseRefs extends Component {

  inputEle = null
  handleClick = () => {
    const inputElement = this.inputEle;
    console.log(inputElement);
  };

  render() {
    return (
      <>
        <input type="text" ref={ele => this.inputEle = ele} />
        <button onClick={this.handleClick}>点击</button>
      </>
    );
  }
}
